package com.shuziren.pojo.entity.vo;

import cn.hutool.json.JSONArray;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.shuziren.config.JsonArrayTypeHandler;
import com.shuziren.pojo.entity.InterviewSchedule;
import lombok.Data;

import java.util.Date;

@Data
@TableName(value = "interview_schedule" , autoResultMap = true)
public class InterviewScheduleVo {
    @TableId(type = IdType.AUTO)
    private Integer id;

    @TableField("candidate_id")
    private Integer candidateId;

    @TableField("position_id")
    private Integer positionId;


    @TableField("interview_time")
    private Date interviewTime;

    @TableField("duration")
    private Integer duration;

    @TableField("digital_interviewer_id")
    private Integer digitalInterviewerId;

    @TableField("notes")
    private String notes;

    @TableField("status")
    private Integer status;

    @TableField("created_at")
    private Date createdAt;

    @TableField("updated_at")
    private Date updatedAt;


    @TableField(value = "questionset",typeHandler = JsonArrayTypeHandler.class)
    private JSONArray questionset;

    @TableField("temporary_passwords")
    private String temporaryPasswords;

    public InterviewSchedule toEntity() {
        InterviewSchedule interviewSchedule = new InterviewSchedule();
        interviewSchedule.setId(this.id);
        interviewSchedule.setCandidateId(this.candidateId);
        interviewSchedule.setPositionId(this.positionId);
        interviewSchedule.setInterviewTime(this.interviewTime);
        interviewSchedule.setDuration(this.duration);
        interviewSchedule.setDigitalInterviewerId(this.digitalInterviewerId);
        interviewSchedule.setNotes(this.notes);
        interviewSchedule.setStatus(this.status);
        interviewSchedule.setCreatedAt(this.createdAt);
        interviewSchedule.setUpdatedAt(this.updatedAt);
        interviewSchedule.setTemporaryPasswords(this.temporaryPasswords);
        return interviewSchedule;
    }
}
